/*     */ package com.lmpop.trade.ts_memlevel;
/*     */ 
/*     */ import com.lmpop.frame.QueryList;
/*     */ import com.lmpop.frame.SysMap;
/*     */ import com.lmpop.frame.TradeInterf;
/*     */ import com.lmpop.frame.dao.DbmInterf;
/*     */ import com.lmpop.frame.exp.ApplicationException;
/*     */ import java.util.Hashtable;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ 
/*     */ public class Ts_memlevelInfo
/*     */   implements TradeInterf
/*     */ {
/*     */   QueryList queryList;
/*     */ 
/*     */   public Ts_memlevelInfo()
/*     */   {
/*  16 */     this.queryList = new QueryList();
/*     */   }
/*     */ 
/*     */   public SysMap insert(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  25 */     Ts_memlevel ts_memlevel = new Ts_memlevel();
/*  26 */     ts_memlevel.setUser_class(map.getInt("user_class"));
/*  27 */     ts_memlevel.setClass_name(map.getString("class_name"));
/*  28 */     ts_memlevel.setDiscount(map.getInt("discount"));
/*  29 */     ts_memlevel.setUp_num(map.getInt("up_num"));
/*  30 */     ts_memlevel.setDown_num(map.getInt("down_num"));
/*  31 */     ts_memlevel.setRsrv_str1(map.getString("rsrv_str1"));
/*  32 */     ts_memlevel.setRsrv_str2(map.getInt("rsrv_str2"));
/*  33 */     ts_memlevel.setRsrv_str3(map.getString("rsrv_str3"));
/*     */ 
/*  35 */     String result_code = "0";
/*     */     try {
/*  37 */       insert(dbmMgr, ts_memlevel);
/*     */     } catch (ApplicationException e) {
/*  39 */       e.printStackTrace();
/*  40 */       result_code = "1";
/*     */     }
/*  42 */     map.setString("result_code", result_code);
/*  43 */     return map;
/*     */   }
/*     */ 
/*     */   public void insert(DbmInterf dbmMgr, Ts_memlevel ts_memlevel)
/*     */     throws ApplicationException
/*     */   {
/*  52 */     dbmMgr.update("insertTs_memlevel", ts_memlevel);
/*     */   }
/*     */ 
/*     */   public SysMap delete(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  62 */     String pkid_string = map.getString("pkid");
/*  63 */     String result_code = "0";
/*     */     try {
/*  65 */       if (!pkid_string.equals("")) {
/*  66 */         String[] pkStr = pkid_string.split("\\|");
/*  67 */         for (int i = 0; i < pkStr.length; i++) {
/*  68 */           if (pkStr[i].equals("")) continue; delete(dbmMgr, pkStr[i]);
/*     */         }
/*     */       }
/*     */     } catch (ApplicationException e) {
/*  72 */       e.printStackTrace();
/*  73 */       result_code = "1";
/*     */     }
/*  75 */     map.setString("result_code", result_code);
/*  76 */     return map;
/*     */   }
/*     */ 
/*     */   public void delete(DbmInterf dbmMgr, String pkid)
/*     */     throws ApplicationException
/*     */   {
/*  85 */     dbmMgr.update("deleteTs_memlevel", pkid);
/*     */   }
/*     */ 
/*     */   public SysMap update(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  94 */     Ts_memlevel ts_memlevel = new Ts_memlevel();
/*  95 */     ts_memlevel.setUser_class(map.getInt("user_class"));
/*  96 */     ts_memlevel.setClass_name(map.getString("class_name"));
/*  97 */     ts_memlevel.setDiscount(map.getInt("discount"));
/*  98 */     ts_memlevel.setUp_num(map.getInt("up_num"));
/*  99 */     ts_memlevel.setDown_num(map.getInt("down_num"));
/* 100 */     ts_memlevel.setRsrv_str1(map.getString("rsrv_str1"));
/* 101 */     ts_memlevel.setRsrv_str2(map.getInt("rsrv_str2"));
/* 102 */     ts_memlevel.setRsrv_str3(map.getString("rsrv_str3"));
/*     */ 
/* 104 */     String result_code = "0";
/*     */     try {
/* 106 */       update(dbmMgr, ts_memlevel);
/*     */     } catch (ApplicationException e) {
/* 108 */       e.printStackTrace();
/* 109 */       result_code = "1";
/*     */     }
/* 111 */     map.setString("result_code", result_code);
/* 112 */     return map;
/*     */   }
/*     */ 
/*     */   public void update(DbmInterf dbmMgr, Ts_memlevel ts_memlevel)
/*     */     throws ApplicationException
/*     */   {
/* 121 */     dbmMgr.update("updateTs_memlevel", ts_memlevel);
/*     */   }
/*     */ 
/*     */   public List getListByPage(Object obj, int start, int limit)
/*     */   {
/* 131 */     Ts_memlevel ts_memlevel = (Ts_memlevel)obj;
/* 132 */     if (start == 0)
/* 133 */       start = 0;
/*     */     else {
/* 135 */       start = (start - 1) * limit;
/*     */     }
/* 137 */     ts_memlevel.setStart(Integer.valueOf(start));
/* 138 */     ts_memlevel.setLimit(Integer.valueOf(limit));
/* 139 */     return this.queryList.getList("getListByTs_memlevelPage", ts_memlevel);
/*     */   }
/*     */ 
/*     */   public int getCountByObj(Object obj)
/*     */   {
/* 150 */     Ts_memlevel ts_memlevel = (Ts_memlevel)obj;
/* 151 */     List list = this.queryList.getList("getCountByObjTs_memlevel", ts_memlevel);
/* 152 */     int count = 0;
/* 153 */     if ((list != null) && (list.size() > 0)) {
/* 154 */       Hashtable newsMap = (Hashtable)list.get(0);
/* 155 */       if ((newsMap.get("count") != null) && (!newsMap.get("count").toString().equals(""))) {
/* 156 */         count = Integer.parseInt(newsMap.get("count").toString());
/*     */       }
/*     */     }
/* 159 */     return count;
/*     */   }
/*     */ 
/*     */   public List getListByPk(String pk)
/*     */   {
/* 169 */     return this.queryList.getList("getTs_memlevelByPk", pk);
/*     */   }
/*     */ 
/*     */   public List getMemLevelAll()
/*     */   {
/* 178 */     return this.queryList.getList("getTs_memlevelALL", "");
/*     */   }
/*     */ 
/*     */   public Map getAll()
/*     */   {
/* 188 */     Map allLevelMap = new Hashtable();
/* 189 */     Map params = new Hashtable();
/* 190 */     String advSelect = "";
/*     */ 
/* 192 */     List levelList = this.queryList.getList("getTs_memlevelALL", "");
/*     */ 
/* 194 */     if (levelList != null) {
/* 195 */       for (int i = 0; i < levelList.size(); i++) {
/* 196 */         Hashtable advMap = (Hashtable)levelList.get(i);
/* 197 */         String user_class = ""; String class_name = "";
/* 198 */         if (advMap.get("user_class") != null) {
/* 199 */           user_class = advMap.get("user_class").toString();
/*     */         }
/* 201 */         if (advMap.get("class_name") != null) {
/* 202 */           class_name = advMap.get("class_name").toString();
/*     */         }
/* 204 */         allLevelMap.put(user_class, class_name);
/*     */       }
/*     */     }
/* 207 */     return allLevelMap;
/*     */   }
/*     */ 
/*     */   public String getAllLevel()
/*     */   {
/* 219 */     Map params = new Hashtable();
/* 220 */     String level = "";
/* 221 */     String para_user_class = "";
/* 222 */     List levelList = this.queryList.getList("getTs_memlevelALL", "");
/* 223 */     if (levelList != null) {
/* 224 */       for (int i = 0; i < levelList.size(); i++) {
/* 225 */         String user_class = ""; String class_name = "";
/* 226 */         Hashtable advMap = (Hashtable)levelList.get(i);
/*     */ 
/* 228 */         if (advMap.get("user_class") != null) {
/* 229 */           user_class = advMap.get("user_class").toString();
/*     */         }
/* 231 */         if (advMap.get("class_name") != null) {
/* 232 */           class_name = advMap.get("class_name").toString();
/*     */         }
/* 234 */         level = level + "<option value=" + user_class + ">" + class_name + "</option>";
/*     */       }
/*     */     }
/* 237 */     return level;
/*     */   }
/*     */ 
/*     */   public String getSelectByPara(String para_user_class)
/*     */   {
/* 249 */     Map params = new Hashtable();
/* 250 */     String levelSelect = "";
/* 251 */     List levelList = this.queryList.getList("getTs_memlevelALL", para_user_class);
/* 252 */     if (levelList != null) {
/* 253 */       for (int i = 0; i < levelList.size(); i++) {
/* 254 */         String user_class = ""; String class_name = "";
/* 255 */         Hashtable advMap = (Hashtable)levelList.get(i);
/* 256 */         if (advMap.get("user_class") != null) {
/* 257 */           user_class = advMap.get("user_class").toString();
/*     */         }
/* 259 */         if (advMap.get("class_name") != null) {
/* 260 */           class_name = advMap.get("class_name").toString();
/*     */         }
/* 262 */         if (para_user_class.equals(user_class))
/* 263 */           levelSelect = levelSelect + "<option value=" + user_class + " selected >" + class_name + "</option>";
/*     */         else {
/* 265 */           levelSelect = levelSelect + "<option value=" + user_class + ">" + class_name + "</option>";
/*     */         }
/*     */       }
/*     */     }
/* 269 */     return levelSelect;
/*     */   }
/*     */ 
/*     */   public boolean checkUser_class(String user_class)
/*     */   {
/* 279 */     List list = this.queryList.getList("checkTs_userclassByPk", user_class);
/*     */ 
/* 281 */     return (list != null) && (list.size() > 0);
/*     */   }
/*     */ }

/* Location:           F:\电商\commons-utils.jar
 * Qualified Name:     com.lmpop.trade.ts_memlevel.Ts_memlevelInfo
 * JD-Core Version:    0.6.0
 */